<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试代码--九九乘法表</title>
<script type="text/javascript">
	function myMethod(value) {
		var ROWS = value;
		//var strNinenine="";
		document
				.write("<table border='1' bordercolor='red' cellspacing='0' cellpadding='8'>");
		for (var i = 1; i <= ROWS; i++) {
			document.write("<tr>" + "<td bgcolor='blue'>" + i + "</td>");
			for (var j = 1; j <= i; j++) {
				document.write("<td bgcolor='yellow'>" + i + "*" + j + "=" + i
						* j + "</td>");
			}
			document.write("</tr>");
		}
		document.write("</table>");

		//document.getElementById("id1").innerHTML=str;
	}
</script>
</head>
<body>
	<script type="text/javascript">
		//将数据显示在指定的textarea区域；

		function showTextarea() {
			//var fu_doc = window.opener.document;//获取父窗口document类；
			//document.write(myMethod(4));
			//document.getElementById("id1").value = myMethod(4);
			document.myform.textarea.value = document.myform.text1.value;
		}

		//可变长度的求和函数；
		var getSum = function() {
			//alert(arguments.length);
			var sum = 0;
			//alert(typeof sum);
			for (var i = 0; i < arguments.length; i++) {
				sum += arguments[i];
			}
			return sum
		}
		alert(getSum(3, 6, 7, 2));
	</script>

	<form name="myform">
		请输入乘数：<input type="text" name="text1" value="9" /> <input
			type="button" name="button" value="显示乘法表"
			onclick="myMethod(document.myform.text1.value)" /> <input
			type="reset" name="reset" value="重置"><br /> 数据显示区域：<br />
		<textarea name="textarea" cols="50" rows="15" id="id1">
			</textarea>
		<br /> <input type="button" name="button2" value="按钮2"
			onclick="showTextarea()">
	</form>

</body>
</html>